import { defineStore } from 'pinia'

const useUserStore = defineStore('user', {
    state: () => {
        return {
            user:{
                id:null,
                username:'',
                password:'',
                nickName:'',
                header:'',
                gender:null,
                email:'',
                isAdmin:null,
                updateBy:null,
                updateTime:'',
                lastLoginTime:'',
                delFlag:null,
                token:''
            },
        }
    },
    actions: {
        setUserInfo(user){
            this.user = user
        },
        logout(){
            this.user={}
        },
        getUserId(){
            return this.user.id
        }
    },
    persist: true
})

export default useUserStore